//
//  BigNumber.h
//  ATM Killer
//
//  Created by USoft on 6/19/14.
//
//

#ifndef BIG_NUMBER_H
#define BIG_NUMBER_H
#include <math.h>
#include <iostream>
//#include "Utils.h"
#include "cocos2d.h"
#include "Utils.h"
USING_NS_CC;
#define imax(a,b) a>b?a:b
class BigNumber : public Ref
{
public:
    UG_PROPERTY_FULL(int, nDigits, NDigits);
    int *number;
    
    BigNumber();
    ~BigNumber();
    
    CREATE_FUNC(BigNumber);
    void initialize(int a);
    void initialize(const char *a);
    int* getNumber();
    void setNumber(int *var);
    BigNumber* add(int temp);
    BigNumber* add(BigNumber *b);
    BigNumber* minus(BigNumber *b);//if a < b , a-b = 0
    BigNumber* multiplyAnElement(int a);
    BigNumber* complexMultiply(BigNumber *b);
    BigNumber* multiplyRationalNumber(double a);
    bool equalToZero();
    bool isDivisible2000();

    static BigNumber* power(float a, int b);
    int compare(BigNumber *b);
    void print();
    char* toString();
    char* display();
private:
    int* addArray(int* a1,int *a2,int nDigits);
    int* minusArray(int* a1,int *a2, int nDigits);
    int* multiplyArrayWithAnElement(int* a1,int a);
    
    void checkNDigits();
    void toZero();
    virtual bool init();
    
};
#endif /* defined(__ATM_Killer__BigNumber__) */
